﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace VPApp
{
	/// <summary>
	/// Interaction logic for BooleanTweaker.xaml
	/// </summary>
	public partial class BooleanTweaker : UserControl
	{
		public event RoutedPropertyChangedEventHandler<bool> OnCheckChanged;

		public BooleanTweaker()
		{
			InitializeComponent();
		}

		public BooleanTweaker(string optionText, RoutedPropertyChangedEventHandler<bool> checkChangedHandler)
		{
			InitializeComponent();
			checkBox1.Content = optionText;
			OnCheckChanged += checkChangedHandler;
		}

		private void checkBox1_Checked(object sender, RoutedEventArgs e)
		{
			if (OnCheckChanged != null)
			{
				OnCheckChanged(this, new RoutedPropertyChangedEventArgs<bool>(false, true));
			}
		}

		private void checkBox1_Unchecked(object sender, RoutedEventArgs e)
		{
			if (OnCheckChanged != null)
			{
				OnCheckChanged(this, new RoutedPropertyChangedEventArgs<bool>(true, false));
			}
		}
	}
}